<?php

namespace Crc\Grid\Filter\Number;

use Crc\Grid\Operator,
    Doctrine\ORM\QueryBuilder;

class Is extends Operator
{
    protected function setName()
    {
        $this->_name = 'is';
    }

    protected function setLabel()
    {
        $this->_label = 'is';
    }

    public function processOperator(QueryBuilder $queryBuilder)
    {
        $alias = $queryBuilder->getRootAlias();
        $queryBuilder->andWhere($alias . '.' . $this->getField(), ':filter_' . $this->getField())
                     ->setParameter('filter_' . $this->getField(), $this->getValue());
        return $queryBuilder;
    }

}